﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;

namespace RiskMan.DataClass.Models.NotBasModels
{
    [Serializable]
    public class TamplateTimeWorkingExhange : INotifyPropertyChanged
    {

        #region private

        private string _name;
        private TimeSpan _startTimeMmvb;
        private TimeSpan _endTimeMmvb;
        private TimeSpan _startTimeForts;
        private TimeSpan _endTimeForts;
        private TimeSpan _startDayKliring;
        private TimeSpan _endDayKliring;
        private TimeSpan _startEveningKliring;
        private TimeSpan _endEveningKliring;

        #endregion

        #region public 
        
        /// <summary>
        /// Название шаблона
        /// </summary>
        public string Name
        {
            get { return _name; }
            set
            {
                if (_name != value)
                {
                    _name = value;
                    RaisePropertyChanged("Name");
                }
            }
        }

        public long tmpStartTimeMmvb { get; set; }
        /// <summary>
        /// Начало сессии на ММВБ
        /// </summary>
        public TimeSpan StartTimeMmvb
        {
            get { return _startTimeMmvb; }
            set
            {
                if (_startTimeMmvb != value)
                {
                    _startTimeMmvb = value;
                    tmpStartTimeMmvb = value.Ticks;
                    RaisePropertyChanged("StartTimeMmvb");
                }
            }
        }

        public long tmpEndTimeMmvb { get; set; }
        /// <summary>
        /// Окончание сессии на ММВБ
        /// </summary>
        public TimeSpan EndTimeMmvb
        {
            get { return _endTimeMmvb; }
            set
            {
                if (_endTimeMmvb != value)
                {
                    _endTimeMmvb = value;
                    tmpEndTimeMmvb = value.Ticks;
                    RaisePropertyChanged("EndTimeMmvb");
                }
            }
        }

        public long tmpStartTimeForts { get; set; }
        /// <summary>
        /// Начало сессии на ФОРТС
        /// </summary>
        public TimeSpan StartTimeForts
        {
            get { return _startTimeForts; }
            set
            {
                if (_startTimeForts != value)
                {
                    _startTimeForts = value;
                    tmpStartTimeForts = value.Ticks;
                    RaisePropertyChanged("StartTimeForts");
                }
            }
        }

        public long tmpEndTimeForts { get; set; }
        /// <summary>
        /// Окончание сессии на ФОРТС
        /// </summary>
        public TimeSpan EndTimeForts
        {
            get { return _endTimeForts; }
            set
            {
                if (_endTimeForts != value)
                {
                    _endTimeForts = value;
                    tmpEndTimeForts = value.Ticks;
                    RaisePropertyChanged("EndTimeForts");
                }
            }
        }

        public long tmpStartDayKliring { get; set; }
        /// <summary>
        /// начало дневного клиринга на ФОРТС
        /// </summary>
        public TimeSpan StartDayKliring
        {
            get { return _startDayKliring; }
            set
            {
                if (_startDayKliring != value)
                {
                    _startDayKliring = value;
                    tmpStartDayKliring = value.Ticks;
                    RaisePropertyChanged("StartDayKliring");
                }
            }
        }

        public long tmpEndDayKliring { get; set; }
        /// <summary>
        /// окончание дневного клиринга на ФОРТС
        /// </summary>
        public TimeSpan EndDayKliring
        {
            get { return _endDayKliring; }
            set
            {
                if (_endDayKliring != value)
                {
                    _endDayKliring = value;
                    tmpEndDayKliring = value.Ticks;
                    RaisePropertyChanged("EndDayKliring");
                }
            }
        }

        public long tmpStartEveningKliring { get; set; }
        /// <summary>
        /// начало вечернего клирина на ФОРТС
        /// </summary>
        public TimeSpan StartEveningKliring
        {
            get { return _startEveningKliring; }
            set
            {
                if (_startEveningKliring != value)
                {
                    _startEveningKliring = value;
                    tmpStartEveningKliring = value.Ticks;
                    RaisePropertyChanged("StartEveningKliring");
                }
            }
        }

        public long tmpEndEveningKliring { get; set; }
        /// <summary>
        /// окончание вечернего клиринга на ФОРТС
        /// </summary>
        public TimeSpan EndEveningKliring
        {
            get { return _endEveningKliring; }
            set
            {
                if (_endEveningKliring != value)
                {
                    _endEveningKliring = value;
                    tmpEndEveningKliring = value.Ticks;
                    RaisePropertyChanged("EndEveningKliring");
                }
            }
        }

        #endregion

        #region event PropertyChangedEventHandler

        public event PropertyChangedEventHandler PropertyChanged;

        protected void RaisePropertyChanged(string propertyName)
        {
            var handler = PropertyChanged;
            if (handler != null)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion
    }
}
